package com.caac.core.config;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.caac.core.dm.OrderProp;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright caac 2006</p>
 * <p>Company: caac</p>
 * @author <a href="mailto:project@caac.com.cn">Project Group</a>
 * @version 1.0
 */

public class OrderClass extends Conf {
    private Map configMap = new HashMap();
    private List dmList = new ArrayList();
    private List defDmList = new ArrayList();

    public void addChild(OrderProperty op) {
        configMap.put(op.getName(), op);
        OrderProp opDm = new OrderProp();
        opDm.setGroupName(getName());
        opDm.setPropName(op.getName());
        opDm.setAsc(Boolean.valueOf(op.isAscend()));
        dmList.add(opDm);
        if (op.isDef()) {
            defDmList.add(opDm);
        }
    }

    public List getChildren() {
        return dmList;
    }

    public List getDefDmChildren() {
        return defDmList;
    }

    public OrderProperty getChild(String key) {
        return (OrderProperty) configMap.get(key);
    }
}
